import get from '@dfeidao/atom-web/local/get';
import set from '@dfeidao/atom-web/local/set';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
// import set_nodes_cls from '@dfeidao/atom-web/ui/set-nodes-cls';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';
interface Aa {
	group_id: string;
	group: string;
}
export default async function a011(fd: IFeidaoAiBrowserComponent, args: Event) {
	const nodea = args.currentTarget as HTMLDivElement;
	const node = nodea.closest('[slist]') as HTMLDivElement;
	const nodes = fd.data.node.querySelectorAll<HTMLDivElement>('[slist]');
	nodes.forEach((i) => {
		set_node_cls(i, 'bg-c', false);

	});
	set_node_cls(node, 'bg-c', true);
	const v = node.getAttribute('v');
	// console.log(JSON.parse(v))
	const obj1 = JSON.parse(v);
	// const objss = JSON.parse(v);
	// console.log(objss)
	const allot_group = get(fd, 'allot_group') as Aa;
	obj1.parent_group_id = allot_group.group_id;
	obj1.group = allot_group.group;
	obj1.role_type_id = get(fd, 'role_type_id');
	obj1.role_allot_id = get(fd, 'role_allot_id');
	// console.log(obj1)
	set(fd, 'shezhi', obj1);
}
